class RssController < ApplicationController
  
  def make
    string =String.new
    results=Swarm.find(:all,:conditions=>"public = 1",:limit=>20,:order=>"id")
    xm=Builder::XmlMarkup.new(:target=>string)
    xm.instruct!
    string << "<rss version=\"2.0\">"
    xm.channel{
      xm.title("dragons swarms")
      xm.link(request.protocol << request.host_with_port)
      xm.description("one p2p system")
      xm.language("en-US")
      xm.copyright("Copyright 2006, enzzy ")
      xm.category("p2p source")
      xm.webmaster("zhu1230@gmail.com")
      xm.image{
        xm.url("../logo.gif")
        xm.title("logo gif")
        xm.link(request.protocol << request.host_with_port)
      }
      results.each {|r|
        xm.item{
        xm.title(r.title)
        xm.description(r.description)
        xm.link(url_for(:controller=>"swarm",:action=>"show_one",:id=>r.url))
        xm.author(r.contact_info)
        xm.category(r.catelog.title)
        xm.pubDate(r.creation_time.strftime("%a,%d %b %y %H:%M:%S GMT"))

        }
      }
    }
    
    string << "</rss>"
    
    @content=string
    @content_type='text/xml'
  @response.headers["Content-Type"] = @content_type
    render :layout=>false
  end
end
